import json
import yaml
from Basic.global_variables_path import *

class RequestUtil():
    # session = session
    # session = requests.session()
    def send_request(self, method, url, datas=None, **kwargs):
        method = str(method).lower()
        res = None
        if method == 'get':
            res = session.request(method=method, url=url, params=datas)
        elif method == 'post':
            if datas is not None and isinstance(datas,dict):
                datas = json.dumps(datas)
            res = session.request(method=method, url=url, data=datas, **kwargs)
        elif method == "put":
            res = session.request(method=method, url=url, json=datas, **kwargs)
        elif method == "delete":
            res = session.request(method=method, url=url, json=datas, **kwargs)

        else:
            print("无效的请求方式，get/post/put/delete,请查找原因！！！")
        return res


if __name__ == '__main__':
    pass